home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / applic / ntp / acts.zoo / hangup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-14  |  1.5 KB  |  61 lines

  1. void hangup()
  2. {
  3. /*
  4.         this subroutine hangs up the modem.
  5.         hayes protocol is used.
  6.         first send a % character to get the distant end to stop
  7.         sending. then put the local modem in the command mode
  8.         and hang it up.
  9.         Note: if manual mode was selected at dialing then we assume
  10.         that we can not hangup the telephone because it is not a Hayes
  11.         compatible.  so send the % character and then return.
  12.  
  13.         this routine is slightly dependent on whether or not BIOS calls
  14.         are used to communicate with the modem.  the non-bios calls are
  15.         faster and different time-out values are needed.
  16. */
  17. #include "nbstime.h"
  18. #ifdef IBMPC
  19. #ifdef BIOS
  20. int tmo = -5;
  21. #endif
  22. #ifndef BIOS
  23. int tmo = -18;
  24. #endif
  25. #endif
  26. #ifdef SUN
  27. int tmo = -5;
  28. #endif
  29. extern char number[30];
  30. char *ptr;
  31. char ans[400];
  32. char ie1 = 'K';
  33. char ie2 = '+';
  34. char ie3 = '0';
  35. void wrtbuf(),wait();
  36. int rdbuf();
  37. int j;
  38.         ptr="%";
  39.         wrtbuf(ptr);
  40.         for(j=0; j<3; j++) wait();
  41. /*
  42.         return now if manual mode dialing
  43. */
  44.         if( (number[3] == 'm') || (number[3] == 'M') ) return;
  45.         ptr="+";
  46.         wrtbuf(ptr);
  47.         wait();
  48.         wrtbuf(ptr);
  49.         wait();
  50.         wrtbuf(ptr);
  51.         rdbuf(ans,ie1,ie2,ie3,tmo);
  52.         wait();
  53.         ptr="ATH\r";
  54.         wrtbuf(ptr);
  55.         rdbuf(ans,ie1,ie3,ie3,tmo);
  56.     wait();
  57.         ptr="ATZ\r";
  58.         wrtbuf(ptr);
  59.         rdbuf(ans,ie1,ie3,ie3,tmo);
  60. }
  61.